// 手写map方法

const mapTs = (arr:Array<any>, callback:Function) => {
  if(!Array.isArray(arr) || arr.length === 0 || typeof callback !== 'function'){
    return []
  } else {
    const res:Array<any> = []
    for (let i = 0;i < arr.length; i++){
      res.push(callback(arr[i], i ,arr))
    }
    return res
  }
}